package com.example.filetest;

import java.io.File;

public class Test10 {
    public static void main(String[] args) {


        File dir1 = new File("D:\\27162\\Desktop\\new");
        System.out.println(have_txt(dir1));


    }


    public static boolean have_txt(File file) {
        for (File listFile : file.listFiles()) {
            if (listFile.isFile() && listFile.getName().endsWith(".txt")) {
                return true;
            }
        }
        return false;
    }
}
